<%--
  Created by IntelliJ IDEA.
  User: 叶叶
  Date: 2022/1/6
  Time: 18:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>产品生产物料设计单审核</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
    <script src="../js/bootstrap-table-zh-CN.min.js"></script>
</head>
<body>
<input id="fhId" type="hidden" value="${fhId}">
<DIV class=DIV_STYLE2 id="div2"><TABLE cellSpacing=0 cellPadding=0 width=1000 align=center bgColor=#ffffff border=0 >
    <div style="position: relative;left: 60%">
        <input class="RADIO_STYLE1" name="tg" type="radio" value="S001-2">未通过
        <input class="RADIO_STYLE1" name="tg" type="radio" value="S001-1">通过
        <input  onclick="queren()" class="btn3_mouseout" type=button value=确认>
        <input  onclick="fanhui()" class="btn3_mouseout" type=button value=返回>
    </div>
    <TBODY>
    <TR>
        <TD class=TABLE_STYLE6 vAlign=bottom rowSpan=2 align=center>
            <TABLE style="BORDER-TOP: #333333 1px solid; BORDER-RIGHT: #333333 1px solid; BORDER-BOTTOM: #333333 1px solid; BORDER-LEFT: #333333 1px solid" cellSpacing=0 cellPadding=0 width="100%" border=0>
                <TBODY>
                <TR>
                    <TD height=10 colSpan=4>
                        <TABLE width="100%">
                            <TBODY>
                            <TR>
                                <TD>
                                    <table align="center">
                                        <tr>
                                            <td><h3>物料组成设计单</h3></td>
                                        </tr>
                                    </table>
                                    <br>
                                    <div>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>产品名称:</span>
                                        <span id="cpmc"></span>
                                        <span style="position: relative;left:300px;">产品编号:<span id="cpbh"></span></span>
                                        <br>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>设计人:<input style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none" id="sjr"></span>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>设计单编号:<span id="sjbh"></span></span>
                                    </div>
                                    <br>
                                    <TABLE id=tableOnlineEdit class=TABLE_STYLE5 borderColor=#000000  cellSpacing=0 cols=1 borderColorDark=#eeeeee cellPadding=0 align=center borderColorLight=#848284 border=1><THEAD>
                                    <TR class=TR_STYLE2 height="10" bgColor=#d2e9ff>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="7%" align=left>编号</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>工序名称</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>工序编号</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="7%" align=left>描述</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>工时数</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>工时单位</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="19%" align=left>单位工时成本</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="22%" align=left>工时成本小计(元)</TD></TR>
                                    <%--                                    <TR class=TR_STYLE1  height=20>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT id=checkLine class=CHECKBOX_STYLE1 type=checkbox value=on name=checkbox></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT onfocus=this.blur() class=INPUT_STYLE4 name=procedure_name>fds</TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT onfocus=this.blur() class=INPUT_STYLE4 name=procedure_ID>fds</TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><SPAN style="WIDTH: 120px; BACKGROUND: #ffffff" name="product_describe_ok"></SPAN><INPUT onfocus=this.blur() class=INPUT_STYLE4 type=hidden name=procedure_describe></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT class=INPUT_STYLE5 name=labour_hour_amount></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT class=INPUT_STYLE5 name=amount_unit></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left><INPUT class=INPUT_STYLE5 name=cost_price></TD>--%>
                                    <%--                                        <TD class=TD_STYLE2 borderColor=#dedbd6 align=left>&nbsp;</TD></TR>
                                                --%>
                                    </THEAD>
                                    </TABLE>
                                    <br>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <span>工时总成本:<span id="zcb"></span></span>
                                    <div>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>审核人:<input style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none" id="djr"></span>
                                        &nbsp;&nbsp;&nbsp;&nbsp;
                                        <span style="position: relative;left:200px;">审核时间:<span id="shijian"></span></span>
                                    </div>
                                    <br>

                                    <div>
                                        <div>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <span style="position: relative;top: -40px">设计要求:</span><textarea style="resize: none" rows=4 cols="100" id="sjyq"></textarea>
                                        </div>
                                    </div>
                                </TD></TR></TBODY></TABLE></TD></TR>
                <TR>
                    <TD width=56 colSpan=3 noWrap></TD></TR>
                <TR>
                    <TD height=100 colSpan=3 noWrap></TD>
                    <TD></TD></TR>
                <TR vAlign=bottom>
                    <TD colSpan=4 noWrap align=center></TD></TR></TD>
                <TR>
                    <TD colSpan=4 noWrap align=right></TD></TR></TBODY></TABLE></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD></TR>
    <TR>
        <TD bgColor=#333333 height=120 width=1></TD>
        <TD bgColor=#666666 height=120 width=1></TD>
        <TD bgColor=#999999 height=120 width=1></TD></TR>
    <TR align=right vAlign=top>
        <TD colSpan=4>
            <TABLE class=TABLE_STYLE6 cellSpacing=0 cellPadding=0 align=center border=0>
                <TBODY>
                <TR>
                    <TD bgColor=#333333 height=1></TD></TR>
                <TR>
                    <TD bgColor=#666666 height=1></TD></TR>
                <TR>
                    <TD bgColor=#999999 height=1></TD></TR></TBODY></TABLE></TD></TR>
    <TR align=right vAlign=middle>
        <TD colSpan=4></TD></TR></TBODY></TABLE></DIV>

<script>
    update1()
    /*赋值到物料通过页面里面的值*/
    function update1() {
        console.log("进入了")
        /*document.getElementById("div1").style.display='none'
        document.getElementById("div2").style.display='block'*/
        var myDate = new Date();
        year = myDate.getYear()+1900;
        month = myDate.getMonth()+1;
        date = myDate.getDate();
        hour = myDate.getHours();
        minute =myDate.getMinutes();
        second = myDate.getSeconds();
        $.ajax({
            type:"get",
            url: "/wl/findDmoduleById",
            data:{id:$("#fhId").val()},
            dataType:"json",
            success:function (data) {
                console.log(data)
                    document.getElementById("sjyq").innerText = data.moduleDescribe
                    document.getElementById("zcb").innerText = data.costPriceSum
                    document.getElementById("sjbh").innerText = data.designId
                    document.getElementById("cpmc").innerText = data.productName
                    document.getElementById("cpbh").innerText = data.productId
                    document.getElementById("djr").value = data.designer
                        document.getElementById("sjr").value=data.register
                    document.getElementById("shijian").innerText=year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second
                zxczc()
            },error:function (data) {
                console.log("Xxx")
            }
        })

    }
    /*确认按钮*/
    function queren() {
        let value = document.getElementsByName("tg");
        let values;
        for(var i=0;i<value.length;i++){
            if(value[i].checked){
               var xx=value[i].value;
            }
            /*values=value[i].checked.value;*/
        }
        /*console.log(values)*/
        var xxx={
            id:$("#fhId").val(),
            checkTag:xx
        }
            let s= JSON.stringify(xxx);
       $.ajax({
                type:"post",
                url: "/wl/upDmoduleById/",
                dataType:"json",
                contentType: "application/json",
           data:s,
                success:function (data) {
                    $("#table").bootstrapTable("refresh")
                },error:function (data) {
                   document.location="/jy/wlsh.jsp"
                }
            })
    }
    function fanhui() {
        $("#table").bootstrapTable("refresh")
    }
    function fanhui() {
        document.location="/jy/wlshd.jsp"
    }

    /*var Dfid;
    $.get("http://localhost:8080/wl/findDmoduleById?id="+${fhId},function (data) {
        Dfid=data.id;
        $("[name=designId]").val(data.designId);
        $("[name=productId]").val(data.productId);
        $("[name=productName]").val(data.productName);
        $("[name=designer]").val(data.designer);
        $("[name=productId1]").val(data.productId1);
        $("[name=productName1]").val(data.productName1);
        $("[name=type]").val(data.type);
        $("[name=amount]").val(data.amount);
        $("[name=amountUnit]").val(data.amountUnit);
        $("[name=costPrice]").val(data.costPrice);
        $("[name=subtotal]").val(data.subtotal);
        $("[id=djr]").val(data.register);
        $("[id=shijian]").val(data.registerTime);
    })

    function upa(th) {
        var isok;
        if(th.value=="通过"){
            isok="S001-1";
        }else {
            isok="S001-2";
        }
        let productId=document.getElementsByName("productId")[0].value;
        console.log(productId+"~~~~~~")
        $.get("http://localhost:8080/wl/upDmoduleById?id="+Dfid+"&status="+isok,function (data) {
            console.log(12345678)
            window.location="/jy/wlshd.jsp";
        })
    }*/

    /*查询物料明细表*/
    function zxczc() {
        console.log("看看")
        let parentId = document.getElementById("cpbh").innerText;
        console.log(parentId)
        $.ajax({
            type:"get",
            url: "/wl/findDModuleDetails/"+parentId,
            dataType:"json",
            success:function (data) {
                 for (var i=0;data.length;i++) {
                document.getElementById("tableOnlineEdit").innerHTML +=
                    "<tr>" +
                            "<td>" + data[i].mid + "</td>" +
                            "<td>" + data[i].productName1 + "</td>" +
                            "<td>" + data[i].productId1 + "</td>" +
                            "<td></td>" +
                            "<td>" + data[i].amount + "</td>" +
                            "<td>" + data[i].amountUnit + "</td>" +
                            "<td>" + data[i].costPrice + "</td>" +
                            "<td>" + data[i].subtotal + "</td>" +
                     "</tr>"

                 }
            },error:function (data) {
                console.log("Xxx")
            }
        })
    }
</script>
</body>
</html>
